package com.hua.api.core.activemq;

import com.hua.api.core.activemq.consumer.QueueConsumer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class QueueConsumerListener {


    @Autowired
    private QueueConsumer queueConsumer;

    /**
     * {
     *     target: 'mall',
     *     event: 'order_create',
     *     data: {
     *          order_no: ''
     *     }
     * }
     * */
    //queue模式的消费者
    @JmsListener(destination=ActiveMqConstant.hua000_api_queue, containerFactory="queueListener")
    // @JmsListener(destination="${spring.activemq.queue-name}", containerFactory="queueListener")
    public void readActiveQueue(String message) {
        // System.out.println("queue接受到：" + message);
        log.info("QueueConsumerListener.readActiveQueue 消息队列收到消息 destination={}",ActiveMqConstant.hua000_api_queue);
        log.info("message={}",message);
        queueConsumer.queuePortal(message);

    }

}
